1. Field of the Invention
The present invention relates to a technique for compositing a physical space image and a virtual space image.
2. Description of the Related Art
Conventionally, as a method of compressing image information of an image formed by pixels whose pixel values are represented by R (Red), G (Green), and B (blue) values, the following method has been proposed. That is, the method of decreasing an amount of information, that is, compressing the image information, by converting RGB pixel data into a set of luminance data and color difference data, such as YUV pixel data or YCbCr pixel data, and decreasing the spatial resolution of the color difference data is available. More specifically, the image is divided into a plurality of pixel groups. In each pixel group, the luminance values of pixels within the pixel group are saved without any change and only representative values of color difference values within the pixel group are saved, thereby decreasing the spatial resolution of the color difference data. Since this method is based on the characteristics of the human eye that is sensitive to a change in brightness but is insensitive to a change in color, a person who is looking at the image does not easily perceive deterioration of the image quality. Therefore, the method has been widely used as an efficient compression method.
In such compression method using color space conversion, however, color misregistration readily occurs near boundaries within an image.
FIG. 2 is a view for explaining color misregistration due to image information compression using color space conversion.
Referring to FIG. 2, reference numeral 201 denotes an image including a spherical object region 201a and a background region 201b. Each pixel of the image 201 has a pixel value in an RGB color space. Reference numerals 202 and 203 denote regions in a boundary portion between the regions 201a and 201b. 
The middle part of FIG. 2 shows the enlarged regions 202 and 203. Each of the regions 202 and 203 includes a plurality of pixels. The image is managed every 1×4 pixels (pixel group) as indicated by solid lines. As described above, in order to decrease image information, the pixel value of each pixel of the image 201 is converted into a set of a luminance value and color difference values, and the color difference values of the pixels of a pixel group are made equal to the color difference values of a pixel at the start position of the pixel group.
The lower part of FIG. 2 shows pixels within the regions 202 and 203 when the pixel values of the pixels within the regions 202 and 203 for which the image information has been decreased as described above are converted into pixel values in the RGB color space. When the image information for the regions 202 and 203 decreases as described above, the color difference values of the pixels at a position next to the start position and subsequent positions within the pixel group are different from the original color difference values, as indicated by pixels 206. If such pixel values of the pixels are converted into those in the RGB color space, the RGB values of the pixels at the position next to the start position and subsequent positions within the pixel group may be considerably different from the original RGB values. If the pixels 206 are located in the boundary portion between the regions 202 and 203, color misregistration occurs near the boundary.
A technique of correcting color misregistration of pixels near a boundary, and reducing deterioration of image quality has already been disclosed (Japanese Patent Laid-Open No. 6-296285). According to the technique, the luminance values and color difference values of pixels arranged along the horizontal, main scan direction are stored in an image memory. The start and end points of an edge at which an amount of change of the luminance value is equal to or larger than a predetermined value are detected. The color difference values of a pixel preceding to the start point of the edge and those of a pixel subsequent to the end point of the edge are corrected by using the color difference values in the image memory.
However, the above-described conventional method has the following problems.
In a method of detecting an edge using the magnitude of an amount of change of luminance value, even if the difference in color looks large, when the luminance values of pixels near the boundary are almost same, it is impossible to detect an edge. As a result, color misregistration in the boundary portion becomes significant. This will be an obstacle especially when faithful background segmentation such as chroma key composition is required. That is, an unnatural image or an image with image quality deterioration is generated.